import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import Test from './Test.jsx';
import styles from './index.module.less';

const Example2 = (props) => {
  const { className } = props;

  const [, setAAA] = useState(0);

  const [bbb] = useState({ a: { b: 2 } });

  useEffect(() => {
    setInterval(() => {
      setAAA(Math.random() * 1000);
    }, 200);

    // setInterval(() => {
    //   setBBB(Math.random() * 1000);
    // }, 1000);
  }, []);

  // window.console.log('render-----');

  return (
    <div className={classnames(styles.root, className)}>
      Hello Example2
      {(() => {
        window.console.log('render-----');
      })()}
      <Test bbb={bbb} />
    </div>
  );
};

Example2.defaultProps = {
  className: null,
};

Example2.propTypes = {
  className: PropTypes.any,
};

export default Example2;
